package com.khalil.kkadmin.module.ai.model;

import com.khalil.kkadmin.infrastructure.jpa.domain.EntityBase;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@Table(name = "ai_model")
@Entity
@EntityListeners(AuditingEntityListener.class)
@EqualsAndHashCode(callSuper = true)
@Data
public class AiModel extends EntityBase<Long> {
    private String name;
    private String description;
    private String apiKey;
    private String baseUrl;
    private String status;

    @Enumerated(EnumType.STRING)
    private ModelType type;

    @Enumerated(EnumType.STRING)
    private Vendor vendor;


    public String getTypeName() {
        if (type == null) return null;
        return type.name();
    }

    public String getVendorName() {
        if (vendor == null) return null;
        return vendor.name();
    }

    public enum ModelType {
        GENERATION,
        EMBEDDING,
        RERANKER,
    }

    public enum Vendor {
        OPENAI_REST,
        OPENAI_SDK,
        DASHSCOPE, // 阿里 百炼平台
    }
}
